Welcome to your PHP Practice Test 2. This test can be taken unlimited times. Signed in users can have their scores saved to be viewed later. Questions will be randomly displaying each test. Good luck! 1. Which of the following functions will generate a warning message, if a file doesn’t exist? fopen() rename() unlink() file_exists()2. Which of the following are conditional statements in PHP? If statement Switch statement foreach statement while statement3. The output of expression "1000" !== "+1000" is: True False4. Which of the following can be used to comment on a single line? // # /^ /$5. Which of the following statement(s) will display output? a. <?php/*blah*/ echo "working"?>b. <?phpecho “working”?>c. <?php /*blah echo "working"*/?>d. <?php /*blah*/ echo “working”; ?> a. b. c. d.6. Which of the following statements is using to execute one more statement more than once? For statement For each statement Foreach statement For – while statement7. Which of the following will create an empty array? $arr = array() $arr = [] $arr = {} $arr = array(“”);8. $_COOKIE is an associative array containing the cookies in PHP. True False9. Which of the following are not considered as Boolean True? 1 -7 0 False10. How to delete or remove a session in PHP? unset() session_destroy() session_unset() session_init()11. Which of the following variables are superglobals in PHP? $_PUT $_GET $_FILES $_ENVR12. If $a = TRUE; and $b = FALSE; which of the following statement(s) evaluate as TRUE? ($a AND $b) ($a or $b) ($a XOR $b) !$a13. Which of the following statement(s) is/are true about objects in PHP? An Object is an instance of a class. You can create an unlimited number of objects from a class Objects are created using _construction keyword You can instantiate an object using the copy keyword14. PHP doesn’t have built-in support for MPEG format. True False15. What does a PHP interpreter do? It executes PHP code one line at a time. It compiles PHP code one line at a time. It creates input for the PHP handler It processes the HTML and PHP files16. Which of the following scope(s) is/are not supported by PHP? Public Private Friendly Finally17. Logical operator XOR returns TRUE if one of the two operands is TRUE True False18. Which PHP tags were deprecated in PHP 7?a. <?php b. <?=c. <%d. <script language = “php”> a. b. c. d.19. Which of the following statement(s) is/are not true about Inheritance? Inheritance is used to create new classes Inheritance lets you use the properties and methods of parent class A child class can have more than one parent class The extends keyword is used to inherit the functionality of parent class20. What will be the output of the following PHP code?var_dump(0123 == 123) True False21. What does fopen() function do? It creates a file if it doesn’t exist. It opens an existing file. It opens the current directory for read operation It creates a new session.22. Which of the following will add comments in PHP? /& /**/ # /#23. PHP scripts can be executed Via the compiler Via the command line Via the web server Via the interpreter24. Which of the following statements are true about PHP? PHP is a Strictly typed language PHP is a Loosely typed language PHP is a general-purpose language PHP is case sensitive language25. An instance of keyword will return true, if You are checking against a child class You are checking against a class that implements the class You are checking against interface You are checking if the class exists or notPlease fill in the comment box below.
Comments